<script>
$(document).ready(function() {
	<?php
	if ($updated == 1) echo 'showNoti("Giao diện: '.$name.'", "Thêm giao diện thành công!", "Ok");';
    if ($failed == 1) echo 'showNoti("Giao diện: '.$name.'", "Cập nhập giao diện thất bại!", "Err");';
    if ($orderby == 'sort_order') echo 'makeDragOrder("' . $GLOBALS['var']['act'] . '", "'.$GLOBALS['var']['mytab'].'", "status","' . $orderby . '", "' . $ordermode . '");';
	?>
});
</script>
<?php echo module_open(); ?>
<tr class="no-border">
    <td>
        <input type="hidden" class="tabId" value="<?php echo $GLOBALS['var']['mytab'] ?>" />
        <ul id="myTab" class="nav nav-tabs">
            <?php
            for ($i = 0; $i < count($GLOBALS['interfaces_groups']); $i++)
            {
                if ($GLOBALS['interfaces_groups'][$i][1])
                {
                    echo '<li class="hide640'.($i == $GLOBALS['var']['mytab'] ? ' active' : '').'" onclick="set_mytab($(this))"><a href="#tabs-'.$i.'" data-toggle="tab">'.$GLOBALS['interfaces_groups'][$i][0].'</a></li>';
                }
            }
            unset($i);
            ?>
            <li class="dropdown active show640">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="current-tab-name"><?php echo $GLOBALS['interfaces_groups'][$GLOBALS['var']['mytab']][0] ?></span> <span class="caret"></span></a>
                <ul class="dropdown-menu">
                <?php
                for($i = 0; $i < count($GLOBALS['interfaces_groups']); $i++)
                {
                    if ($GLOBALS['interfaces_groups'][$i][1])
                    {
                        echo '<li'.($i == $GLOBALS['var']['mytab'] ? ' class="active"' : '').' onclick="set_mytab($(this))"><a href="#tabs-'.$i.'" data-toggle="tab">'.$GLOBALS['interfaces_groups'][$i][0].'</a></li>';
                    }
                }
                ?>
                </ul>
            </li>
        </ul>
        <div id="myTabContent" class="tab-content">
        <?php
        for ($t = 0; $t < count($GLOBALS['interfaces_groups']); $t++)
        {
            if ($GLOBALS['interfaces_groups'][$t][1])
            {
        ?>
            <div id="tabs-<?php echo $t ?>" class="tab-pane<?php echo ($t == $GLOBALS['var']['mytab'] ? ' active" ' : '') ?>">
                <table>
                    <tr class="nodrop">
                        <?php if ($GLOBALS['per']['del']) echo '<td class="head center" width="1%"><input type="checkbox" class="checkAll" /></td>'; ?>
                        <td class="head center" width="2%"><?php echo create_sort('id') ?> #</td>
                        <td class="head" width="15%">Tên media</td>
                        <td class="head hide480" width="25%">Tệp tin / Màu</td>
                        <td class="head hide640" width="10%">Ngày up</td>
                        <td class="head hide480" width="5%"><?php echo create_sort('sort_order') ?> Kích hoạt</td>
                        <td class="head" width="1%">&nbsp;</td>
                    </tr>
                    <?php
                    if (count($tab_interfaces[$t]) && is_array($tab_interfaces[$t]))
                    {
                        $n = 1;
                        foreach ($tab_interfaces[$t] as $row)
                        {
                    ?>
                    <tr class="highlight<?php echo ($row['isnew'] ? ' table-flag-red' : '') ?>" id="<?php echo $row['id'] ?>" name="<?php echo $row['name_vn'] ?>">
                        <?php if ($GLOBALS['per']['del']) echo '<td class="fr center">'.sel_item($row['id']).'</td>'; ?>
                        <td class="fr center"><?php echo stt($row['id'], $n++) ?></td>
                        <td class="fr"><?php echo $row['name_vn'] ?></td>
                        <td class="fr hide480">
                            <?php
                            if(goodfile(INTERF.$row['file']))
                            {
                                if($row['type'] == 'swf')
                                {
                                    echo show_flash(INTERF.$row['file'], 120, 50);
                                }
                                else
                                {
                                    echo show_img(INTERF.$row['file'], 'preview_img');
                                }
                            }
                            else if($row['file'])
                            {
                                echo 'Tệp tin không tồn tại!';
                            }
                            if($row['color'] && ($row['cat'] == 2 || $row['cat'] == 4))
                            {
                                echo '<div class="seletcColor" style="float: left;"><div><div style="background-color: '.$row['color'].';"></div></div></div>';
                            }
                            ?>
                        </td>
                        <td class="fr hide640"><?php echo strftime('%d/%m/%Y %I:%M', strtotime($row['date_added'])) ?></td>
                        <td class="fr center hide480"><?php echo change_status($row['id'], $row['status'], 'status', '', $row['cat'] == 0, '', !$GLOBALS['per']['edit']) ?></td>
                        <td class="fr center" nowrap="nowrap">
                            <?php if ($GLOBALS['per']['edit']) echo edit_alink('', $url_update.'/'.$row['id'].$uri_str); ?>
                            <?php if ($GLOBALS['per']['del']) echo del_restore_link($row['id'], $row['deleted']); ?>
                        </td>
                    </tr>
                    <?php
                        }
                    }
                    else
                    {
                        echo no_data_mes(7);
                    }
                    ?>
                </table>
            </div>
	    <?php
            }
	    }
		?>
        </div>
    </td>
</tr>
<?php echo module_close(); ?>